<template>
    <div>

        <h3>欢迎 {{ loginName }} 使用蜗牛书城后台管理系统!</h3>
        <el-button @click="showAll()">测试登录拦截</el-button>
        <el-button @click="showAll()">get请求测试</el-button>
        <el-button @click="getById()">getById请求测试</el-button>
        <el-button @click="deleteById()">deleteById请求测试</el-button>

    </div>
</template>

<script>
export default {
    name: "WelcomeView",
    data() {
        return {
            "loginName": "默认jack"
        }
    },
    methods: {
        showAll() {
            // post方式二：直接使用json传参数
            this.$axios.post("/api/showAll", {
                pageNum: 11,
                pageSize: 33
            }).then(res => {
                console.log(res);
            })
        },
        getById() {
            this.$axios.get("/api/account/88").then(res => {
                console.log(res);
            })
        },
        deleteById() {
            this.$axios.delete("/api/account/99").then(res => {
                console.log(res);
            })
        },
        showLoginName() {
            this.loginName = sessionStorage.getItem("loginName");
        }
    },
    created() {
        this.showLoginName();
    }

}
</script>

<style scoped>

</style>
